package cn.xgj.sfzy.service.impl;

import cn.xgj.sfzy.entity.Psychology;
import cn.xgj.sfzy.mapper.PsychologyMapper;
import cn.xgj.sfzy.service.PsychologyService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName PsychologyServiceImpl
 * @Description TODO
 * @Author 李政阳
 * @Date 2024年10月24日 9:59
 * @Version 1.0
 */
@Service
public class PsychologyServiceImpl implements PsychologyService {

    @Autowired
    private PsychologyMapper mapper;

    @Override
    public int add(Psychology psychology) {
        return mapper.add(psychology);
    }

    @Override
    public int delete(Integer id) {
        return mapper.delete(id);
    }

    @Override
    public int update(Psychology psychology) {
        return mapper.update(psychology);
    }

    @Override
    public PageInfo<Psychology> findByPage(Integer pageNum, Integer pageSize, Psychology psychology) {
        PageHelper.startPage(pageNum,pageSize);
        List<Psychology> list = mapper.findAll(psychology);
        PageInfo<Psychology> info = new PageInfo<Psychology>(list);
        return info;
    }
}
